#!/usr/bin/env ruby
require 'libglade2'

class RPlaya 
  include GetText

  attr :glade
  
  def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)
    bindtextdomain(domain, localedir, nil, "UTF-8")
    @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}
		@window = @glade['playaWindow']
    @window.show_all 
  end
  
  def on_timeBar_press(widget, arg0)
		#FIXME Implement this
		puts "on_timebar_press not implemented yet"
  end
  def exit_playa(widget)
		Gtk.main_quit
  end
  def on_open_clicked(widget)
   	dialog = Gtk::FileChooserDialog.new(
						"Open File", @window, Gtk::FileChooser::ACTION_OPEN, nil,
						[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
						[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])

		if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
			puts "filename = #{dialog.filename}"
		end

		dialog.destroy
  end
  def on_timeBar_release(widget, arg0)
		#FIXME Implement this
    puts "on_timeBar_release() is not implemented yet."
  end
  def on_playPause_clicked(widget)
		#FIXME Implement this
    puts "on_playPause_clicked() is not implemented yet."
  end
end

# Main program
if __FILE__ == $0
  # Set values as your own application. 
  PROG_PATH = "..\\playa.glade"
  PROG_NAME = "YOUR_APPLICATION_NAME"
  Gtk.init
  RPlaya.new(PROG_PATH, nil, PROG_NAME)
  Gtk.main
end
